// NACL MOD TRACK "third_party/nacl-glibc/sysdeps/nacl/mprotect.c"

#include <errno.h>
#include <sys/mman.h>

#include <irt_syscalls.h>

int __mprotect (const void *addr, size_t len, int prot) {
  ENOSYS_IF_NULL(__nacl_irt_mprotect)

  int result = __nacl_irt_mprotect ((void *) addr, len, prot);
  if (result != 0) {
    errno = __nacl_abi_errno_to_errno(result);
    return -1;
  }
  return 0;
}

weak_alias (__mprotect, mprotect);